/******************************************************************
 * Copyright (c) 2007 - 2007, Simon Guerard, All rights reserved.
 * 
 * Projet de jeu de course au large.
 * 
 * This File is part of Sail-Race
 * 
 * Sail-Race is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
 * 
 * Sail-Race is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with Sail-Race; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 */

package net.simcafamily.sailrace.panel;

import java.awt.Graphics;
import java.awt.Image;

import javax.swing.JPanel;

/**
 * @author qdin
 * 
 */
public class ImagePanel extends JPanel {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = -88719017960749874L;
    private final Image image;
    private final Float alpha;

    /**
     * @param image
     */
    public ImagePanel(Image image) {
	this(image, Float.valueOf("1"));
    }

    /**
     * @param image
     */
    public ImagePanel(Image image, Float alpha) {
	super();
	this.image = image;
	this.alpha = alpha;
    }

    /**
     * @see javax.swing.JComponent#paint(java.awt.Graphics)
     */
    @Override
    public void paint(Graphics g) {
	super.paint(g);
    }

    /**
     * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
     */
    @Override
    protected void paintComponent(Graphics g) {
	super.paintComponent(g);
	// ajout d'un filtre alpha
	g.drawImage(image, 0, 0, getWidth(), getHeight(), this);
    }

}
